package com.example.hello.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.example.hello.entity.Department;

/**
 * 部门Mapper接口
 */
@Mapper
public interface DepartmentMapper {
    
    /**
     * 查询所有未删除的部门
     */
    List<Department> selectAllDepartments();
    
    /**
     * 根据条件分页查询部门
     */
    List<Department> selectDepartmentsByCondition(@Param("departmentName") String departmentName);
    
    /**
     * 根据ID查询部门
     */
    Department selectDepartmentById(@Param("id") Integer id);
    
    /**
     * 插入部门
     */
    int insertDepartment(Department department);
    
    /**
     * 更新部门
     */
    int updateDepartment(Department department);
    
    /**
     * 逻辑删除部门
     */
    int deleteDepartmentById(@Param("id") Integer id);
    
    /**
     * 根据部门名称查询部门（用于检查重复）
     */
    Department selectDepartmentByName(@Param("departmentName") String departmentName);
}
